﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject;
using GalaSoft.MvvmLight;

namespace Nx.Shell.ViewModels
{
    public class ViewModelLocator : IDisposable
    {
        private IKernel _kernel;

        public ViewModelLocator(IKernel kernel)
        {
            _kernel = kernel;
        }

        public ViewModelBase ShellViewModel
        {
            get { return _kernel.Get<ShellViewModel>(); }            
        }

        ~ViewModelLocator()
        {
            Dispose(false);            
        }

        public void Dispose()
        {
            Dispose(true);
        }

        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                _kernel = null;
            }
        }
    }
}
